<h1>
    <span></span><?= lang('label_sms_archive') . ' (' . str_replace(array('%send%', '%from%'), array($used, $total), lang('label_sms_send_from')) . ')' ?></h1>

<ul class="breadcrumb">
    <li><a href="<?= base_url() ?>"><?= lang('label_home') ?></a></li>
    <li><?= lang('label_sms_archive') ?></li>
</ul>


<div class="page">
    <div class="submit" style="<?= (LANG == 'ar') ? 'text-align: left;' : 'text-align: right;' ?>">
        <a href="<?= base_url() ?><?= get_segment(1) ?>/send"><?= lang('label_sms_send') ?></a>
    </div>
    <?php if ($result) { ?>
        <table id="tablestyle">
            <thead>
                <tr class="head-row">
                    <th><?= lang('label_sms_message') ?></th>
                    <th><?= lang('label_sms_total_numbers') ?></th>
                    <th><?= lang('label_statues') ?></th>
                    <th><?= lang('label_created_date') ?></th>
                    <th><?= lang('label_operation') ?></th>
                </tr>
            </thead>

            <tbody>
                <?php
                foreach ($result as $res) {
                    $tool_tip = '<ul>';
                    $tool_tip.='<li>';
                    $tool_tip.='<label><b>';
                    $tool_tip.=lang('label_sms_total_send') . ':</b> ';
                    $tool_tip.= $totalnums = get_message_sendto($res->id, true, 'all');
                    $tool_tip.='</label>';
                    $tool_tip.='</li>';
                    $tool_tip.='<li>';
                    $tool_tip.='<label><b>';
                    $tool_tip.=lang('label_sms_wait_send') . ':</b> ';
                    $tool_tip.=get_message_sendto($res->id, true, 'wait');
                    $tool_tip.='</label>';
                    $tool_tip.='</li>';
                    $tool_tip.='<li>';
                    $tool_tip.='<label><b>';
                    $tool_tip.=lang('label_sms_success_send') . ':</b> ';
                    $tool_tip.=get_message_sendto($res->id, true, 'send');
                    $tool_tip.='</label>';
                    $tool_tip.='</li>';
                    $tool_tip.='<li>';
                    $tool_tip.='<label><b>';
                    $tool_tip.=lang('label_sms_fail_send') . ':</b> ';
                    $tool_tip.=get_message_sendto($res->id, true, 'fail');
                    $tool_tip.='</label>';
                    $tool_tip.='</li>';
                    $tool_tip.='<li>';
                    $tool_tip.='<label><b>';
                    $tool_tip.=lang('label_sms_start_date') . ':</b> ';
                    $tool_tip.= $res->start_date;
                    $tool_tip.='</label>';
                    $tool_tip.='</li>';
                    $tool_tip.='<li>';
                    $tool_tip.='<label><b>';
                    $tool_tip.=lang('label_sms_end_date') . ':</b> ';
                    $tool_tip.= $res->end_date;
                    $tool_tip.='</label>';
                    $tool_tip.='</li>';
                    $tool_tip.='</ul>';
                    ?>

                    <tr <? if (!empty($res->message)) { ?>
                            class="row sweet-tooltip" data-style-tooltip="tooltip-sweet-strong"
                            data-text-tooltip="<?php echo $tool_tip; ?>" <? } ?>>
                        <td><?php echo substr($res->message, 0, 95); ?></td>
                        <td><?php echo $totalnums; ?></td>
                        <td style="text-align: center"><img style="z-index: -1" src="<?= base_url(APPPATH . "views/" . $this->themes->Cms_themes() . "/images/$res->type.png") ?>" ></td>
                        <td><?= timespan($res->create_date) ?> </td>

                        <td>
                            <a href="<?php echo base_url() . get_segment(1); ?>/cancel/<?php echo $res->id; ?>"><?php echo lang('label_cancel') ?></a>
                            <a href="<?php echo base_url() . get_segment(1); ?>/show/<?php echo $res->id; ?>"><?php echo lang('label_show') ?></a>
                        </td>
                    </tr>

                <? } ?>
            </tbody>
        </table>
    <?php } else { ?>
        <div class="unsaved">
            <img src="<?php echo str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']) ?>/<?php echo APPPATH ?>views/<?php echo $this->themes->Cms_themes() ?>/images/unsaved.png" alt="" />
            <div><?= lang('message_no_sms') ?></div>
        </div>
        <br /><br /><br /><br />
    <?php } ?>

</div>

<link rel="stylesheet"
      href="<?php echo str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']) ?>/<?php echo APPPATH ?>/views/<?php echo $this->themes->Cms_themes() ?>/css/sweet-tooltip.css">
<script>!window.jQuery && document.write(unescape('%3Cscript src="jquery-1.7.1.min.js"%3E%3C/script%3E'))</script>
<script type="text/javascript"
src="<?php echo str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']) ?>/<?php echo APPPATH ?>/views/<?php echo $this->themes->Cms_themes() ?>/js/sweet-tooltip.js"></script>
